//
//  AdiAdBanner.m
//  PaintWar
//
//  Created by Tai Le on 10/13/14.
//
//

#import "AdiAdBanner.h"

@implementation AdiAdBanner

- (id)init
{
    self = [super init];
    if (self)
    {
        [self cycleAds];
    }
    
    return self;
}

- (void)cycleAds
{
    [super cycleAds];
    
    _adBannerView.delegate = nil;
    _adBannerView = nil;
    
    _adBannerView = [[ADBannerView alloc] init];
    _adBannerView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierLandscape];
    _adBannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
    _adBannerView.delegate = self;
}

- (id)getAds
{
    return _adBannerView;
}

- (void)releaseAds
{
    [super releaseAds];
    
    _adBannerView.delegate = nil;
    _adBannerView = nil;
}

#pragma mark - Delegate
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    [self raiseDidLoad:banner];
}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    [self raiseDidFail:banner error:error];
}

- (void)bannerViewActionDidFinish:(ADBannerView *)banner
{
    [self raiseDidUnload:banner];
}

@end
